#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
using namespace std;
#ifdef ONLINE_JUDGE

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
    int p = 0, flg = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') flg = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        p = p * 10 + c - '0';
        c = getchar();
    }
    return p * flg;
}
void write(int x) {
    if (x < 0) {
        x = -x;
        putchar('-');
    }
    if (x > 9) {
        write(x / 10);
    }
    putchar(x % 10 + '0');
}
bool _stmer;

const int N = 2e5 + 5, inf = 2e9 + 100;

array <int, N> s, h;

namespace Subtask1 {

array <int, N> ans;

void main(int n) {
    ans.fill(2e9 + 100);
    for (int i = 1; i <= n; i++) {
        int res1 = s[i], res2 = h[i];
        for (int j = i; j <= n; j++)
            res1 = min(res1, s[j]), res2 = min(res2, h[j]), ans[j - i + 1] = min(ans[j - i + 1], abs(res1 - res2));
    }
    for (int i = 1; i <= n; i++)
        write(ans[i]), puts("");
}

} //namespace Subtask1

namespace Subtask2 {

void main(int n) {
    int ans = 2e9 + 10;
    for (int i = 1; i <= n; i++)
        ans = min(ans, s[i]);
    for (int i = 1; i <= n; i++)
        write(ans - 1), puts("");
}

} //namespace Subtask2

namespace Subtask3 {

namespace Sgt {

array <int, N * 4> edge, tag;

void pushdown(int x) {
    if (!tag[x]) return;
    edge[x * 2] = max(edge[x * 2], tag[x]);
    edge[x * 2 + 1] = max(edge[x * 2 + 1], tag[x]);
    tag[x * 2] = max(tag[x * 2], tag[x]);
    tag[x * 2 + 1] = max(tag[x * 2 + 1], tag[x]);
    tag[x] = 0;
}

void modify(int x, int l, int r, int L, int R, int y) {
    if (L > r || R < l) return;
    if (L <= l && R >= r) {
        edge[x] = max(edge[x], y);
        tag[x] = max(tag[x], y);
        return;
    }
    pushdown(x);
    int mid = (l + r) >> 1;
    if (L <= mid) modify(x * 2, l, mid, L, R, y);
    if (R > mid) modify(x * 2 + 1, mid + 1, r, L, R, y);
    /* edge[x] = max(edge[x * 2], edge[x * 2 + 1]); */
}

int query(int x, int l, int r, int k) {
    if (l == r) return edge[x];
    pushdown(x);
    int mid = (l + r) >> 1;
    if (k <= mid) return query(x * 2, l, mid, k);
    else return query(x * 2 + 1, mid + 1, r, k);
}

} //namespace Sgt

array <int, N> isl;

void main(int n) {
    vector <int> stk;
    for (int i = 1; i <= n; i++) {
        while (stk.size() && s[i] <= s[stk.back()])
            stk.pop_back();
        if (stk.size()) isl[i] += i - stk.back();
        else isl[i] += i;
        stk.push_back(i);
    }
    stk.clear();
    for (int i = n; i; i--) {
        while (stk.size() && s[i] <= s[stk.back()])
            stk.pop_back();
        if (stk.size()) isl[i] += stk.back() - i - 1;
        else isl[i] += n - i;
        stk.push_back(i);
    }
    for (int i = 1; i <= n; i++)
        Sgt::modify(1, 1, n, 1, isl[i], s[i]);
    for (int i = 1; i <= n; i++)
        write(h[1] - Sgt::query(1, 1, n, i)), puts("");
}

} //namespace Subtask3

bool _edmer;
int main() {
    cerr << (&_stmer - &_edmer) / 1024.0 / 1024.0 << "MB\n";
#ifndef cxqghzj
    freopen("min.in", "r", stdin);
    freopen("min.out", "w", stdout);
#endif
    int n = read();
    bool flg = 1;
    for (int i = 1; i <= n; i++) s[i] = read();
    for (int i = 1; i <= n; i++) h[i] = read(), flg &= h[i] == 1;
#ifdef cxqghzj
    /* Subtask3::main(n); */
#endif
    if (n <= 1e3) Subtask1::main(n);
    else if (flg) Subtask2::main(n);
    else Subtask3::main(n);
    return 0;
}
